Check if a number can be expressed as x^y